package com.qf.controller;

import com.qf.pojo.User;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/*
 *@Description:
 *@author:刘哥
 *@Date:11:11 2022/7/15
 */
@Controller
@RequestMapping("/users")
public class UserController {
    @Autowired
    private UserService userService;
//    @GetMapping
//    public String queryUsers(Model model){
//        List<User> userList = userService.findAll();
//        System.out.println("userList = " + userList);
//        model.addAttribute("users",userList);
//        return "user";
//    }
    @GetMapping
    public String queryPage(Model model,
                            @RequestParam(name ="pageNum",defaultValue = "1") Integer pageNum,
                            @RequestParam(name ="pageSize", defaultValue= "1")Integer pageSize){
        Object o = userService.findPage(pageNum,pageSize);
        model.addAttribute("data",o);
        return "userPro";
    }



}
